package org.easiermock;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A basic implementation of the MockContext interface.
 * 
 * @author Neil Fuller
 */
class DefaultMockContext implements MockContext {

	private List<MethodListener> methodListeners = 
		Collections.synchronizedList(new ArrayList<MethodListener>());
	
	public MethodListener[] getMethodListeners() {
		return methodListeners.toArray(new MethodListener[0]);
	}
	
	/**
	 * Add a MethodListener to this context
	 * 
	 * @param methodListener the MethodListener to add
	 */
	public void addMethodListener(MethodListener methodListener) {
		methodListeners.add(methodListener);
	}

}
